package com.doge;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

import java.util.ArrayList;


public class Menu implements Screen{

	public Main parent;                 
	public SpriteBatch spriteBatch;
	public BitmapFont font;
	//public ArrayList<Button> buttons;
	//public ImageButtonStyle s;
	public TextureRegion background;

	public Menu(float width, float height, boolean keepAspect, SpriteBatch spriteBatch, Main parent){

		this.parent = parent;
		//this.spriteBatch = spriteBatch;

		font = new BitmapFont();
		
		background = parent.textures.title;

		
		//buttons = new ArrayList<Button>();
		//s = new ImageButtonStyle();
		//s.up = new TextureRegionDrawable(parent.textures.button);
		//s.imageOver = new TextureRegionDrawable(parent.textures.button);

		//buttons.add(new ImageButton(s));
		//buttons.get(0).setPosition(500, 500);
		
	}



	@Override
	public void render(float delta) {
		if(Gdx.input.isKeyPressed(Input.Keys.ANY_KEY)){
			this.dispose();
		}
		else{
		spriteBatch.begin();
		spriteBatch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		font.draw(spriteBatch, "PRESS ANY KEY TO BEGIN", Gdx.graphics.getWidth()/2 - font.getBounds("PRESS ANY KEY TO BEGIN").width/2,10+font.getXHeight());
		spriteBatch.end();
		}
	}



	@Override
	public void resize(int width, int height) {
		System.out.println("menu resize");

	}

	@Override
	public void show() {
		System.out.println("menu");
		spriteBatch = new SpriteBatch();
	}


	@Override
	public void hide() {
		// TODO Auto-generated method stub

	}



	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}



	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}



	@Override
	public void dispose() {
		this.spriteBatch.dispose();
		this.font.dispose();
		parent.setScreen(parent.overworld);

	}
}
